package com.springcloud.mapping;

import com.springcloud.entity.JobInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * (JobInfo)表mapper层
 * @Description：JobInfo 数据库操作
 * @author xiaolei
 * @data 2020-01-27 14:33:32
 */
public interface JobInfoMapping {


    /**
     * @Description：通过ID查询单条数据
     * @param：id 主键
     * @return：JobInfo
     * @author：xiaolei
     * @date：2020-01-27 14:33:32
     */
    @Select(" select id, company_name, company_addr, company_info, job_name, job_info, salary_min, salary_max, url, time, address from job_info where id = #{id} ")
    JobInfo queryById(Long id);


    /**
     * 通过实体作为筛选条件查询
     *
     * @param jobInfo 实例对象
     * @return List<JobInfo>
     * @author：xiaolei
     * @date：2020-01-27 14:33:32
     */
    @Select(" select id, company_name, company_addr, company_info, job_name, job_info, salary_min, salary_max, url, time, address  from job_info where 1=1 ") 
    List<JobInfo> queryAll(JobInfo jobInfo);

    /**
     * 新增数据
     *
     * @param jobInfo 实例对象
     * @return 影响行数
     * @author：xiaolei
     * @date：2020-01-27 14:33:32
     */ 
    @Insert(" insert into job_info (company_name, company_addr, company_info, job_name, job_info, salary_min, salary_max, url, time, address) values (#{companyName}, #{companyAddr}, #{companyInfo}, #{jobName}, #{jobInfo}, #{salaryMin}, #{salaryMax}, #{url}, #{time}, #{address})") 
    int insert(JobInfo jobInfo);


    /**
     * 修改数据
     *
     * @param jobInfo 实例对象
     * @return 影响行数
     * @author：xiaolei
     * @date：2020-01-27 14:33:32
     */  
    @Update("update job_info  where id = #{id}") 
    int update(JobInfo jobInfo);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 影响行数
     * @author：xiaolei
     * @date：2020-01-27 14:33:32
     */  
    @Delete("delete from job_info where id = #{id}") 
    int deleteById(Long id);

}